package com.google.code.openperfmon.service;

import com.google.code.openperfmon.dao.HostDAO;
import com.google.code.openperfmon.dao.MonitorDefinitionDAO;
import com.google.code.openperfmon.dao.MonitorInstanceDAO;
import com.google.code.openperfmon.dao.UserDAO;

public class ServiceFactory {
	private static final UserDAO USER_DAO;
	private static final MonitorDefinitionDAO DEFINITION_DAO;
	private static final MonitorInstanceDAO INSTANCE_DAO;
	private static final HostDAO HOST_DAO;
	
	private static final UserService USER_SERVICE;
	private static final MonitorDefinitionService DEFINITION_SERVICE;
	private static final ExecutionService EXECUTION_SERVICE;
	private static final HostService HOST_SERVICE;
	
	static {
		USER_DAO = new UserDAO();
		DEFINITION_DAO = new MonitorDefinitionDAO();
		INSTANCE_DAO = new MonitorInstanceDAO();
		HOST_DAO = new HostDAO();
		
		USER_SERVICE = new UserService(USER_DAO);
		DEFINITION_SERVICE = new MonitorDefinitionService(DEFINITION_DAO, INSTANCE_DAO);
		EXECUTION_SERVICE = new ExecutionService();
		HOST_SERVICE = new HostService(HOST_DAO, INSTANCE_DAO);
	}

	public static HostService getHostService() {
		return HOST_SERVICE;
	}

	public static UserService getUserService() {
		return USER_SERVICE;
	}

	public static MonitorDefinitionService getMonitorDefinitionService() {
		return DEFINITION_SERVICE;
	}

	public static ExecutionService getExecutionService() {
		return EXECUTION_SERVICE;
	}
}
